const { app, BrowserWindow, Menu, ipcMain, shell } = require('electron')
const path = require('path')
const url = require('url')

let win

function createWindow() {
    //新建一个浏览器窗口作为应用的壳
    win = new BrowserWindow({ width: 800, height: 600 })
    //不要菜单
    Menu.setApplicationMenu(null)

    // GitChat的入口
    win.loadURL("http://www.gitbook.cn")

    //注册关闭事件
    win.on('closed', () => {
        win = null
    })
    isReady = true
}

/**
 * 应用就绪创建窗口
 */
app.on('ready', createWindow)


app.on('window-all-closed', () => {
    if (process.platform !== 'darwin') {
        app.quit()
    }
})

app.on('activate', () => {
    if (win === null) {
        createWindow()
    }
})